<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>错题详情</title>
    <style>
        .join_title{
            border-bottom:1px solid #ddd;
            padding-bottom:50px;
        }
        .join_cuoti{
            float: right;
            border:0;
            padding:5px 10px;
        }
        .join_ye{
            background: yellow;
        }
        .join_gr{
            background: gray;
            border:1px solid gray;
        }
    </style>
</head>

<body>
    <div class="xuanshang">
        <div class="join_title">
            ${stem}
            <button class="join_cuoti">加入错题本</button>
        </div>


        <div style="clear:both"></div>
            ${answer}
    </div>
    <input type="hidden" id="joinIdd" value="${id}">
    <input type="hidden" id="joinToken" value="${token}">
    <input type="hidden" id="joinHidden" value="${is_join}">
</body>
<script src="../js/jquery.js"></script>
<script>

    $(function(){
        var joinIdd=$('#joinIdd').val();
        var joinToken=$('#joinToken').val();
        var joinHidden=$('#joinHidden').val();
       if(joinHidden==0){
           $('.join_cuoti').addClass('join_ye').removeClass('join_gr');
           $('.join_cuoti').on('click',function(){
               $.ajax({
                   type:'post',
                   url:'http://app.scjapp.com:8088/cuotigou/wrongTopic/add',
                   data:{
                       id:joinIdd,
                       token:joinToken
                   },
                   success:function(data){
                       console.log(data);
                       $('.join_cuoti').addClass('join_gr').removeClass('join_ye');
                   }
               })
           })
       }else if(joinHidden==1){
        $('.join_cuoti').addClass('join_gr').removeClass('join_ye');
       }
    })
</script>
</html>